Both the subdir and prepare arguments are very specific to
building the extensions-tool subproject stand-alone. In order
to make the script more generic, turn those required arguments
into optional --subdir and --prepare ones.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2712>
'C Development Tools and Libraries' &&
./.gitlab-ci/install-meson-project.sh \
+ --subdir subprojects/extensions-tool/ \
+ --prepare ./generate-translations.sh \
-Dman=false \
https://gitlab.gnome.org/GNOME/gnome-shell.git \
- main \
- subprojects/extensions-tool/ \
- ./generate-translations.sh &&
+ main &&
dnf clean all
usage() {
cat <<-EOF
- Usage: $(basename $0) [OPTION…] REPO_URL COMMIT SUBDIR PREPARE
+ Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
Check out and install a meson project
Options:
-Dkey=val Option to pass on to meson
+ --subdir Build subdirectory instead of whole project
+ --prepare Script to run before build
-h, --help Display this help
TEMP=$(getopt \
--name=$(basename $0) \
--options='D:h' \
+ --longoptions='subdir:' \
+ --longoptions='prepare:' \
--longoptions='help' \
-- "$@")
unset TEMP
MESON_OPTIONS=()
+SUBDIR=.
+PREPARE=:
while true; do
case "$1" in
shift 2
;;
+ --subdir)
+ SUBDIR=$2
+ shift 2
+ ;;
+
+ --prepare)
+ PREPARE=$2
+ shift 2
+ ;;
+
-h|--help)
usage
exit 0
esac
done
-if [[ $# -lt 4 ]]; then
+if [[ $# -lt 2 ]]; then
usage
exit 1
fi
REPO_URL="$1"
COMMIT="$2"
-SUBDIR="$3"
-PREPARE="$4"
CHECKOUT_DIR=$(mktemp --directory)
trap "rm -rf $CHECKOUT_DIR" EXIT